//
//  ThreeImageCell.m
//  Product_NEWS
//
//  Created by dllo on 16/1/7.
//  Copyright © 2016年 FCH. All rights reserved.
//



#define kMG_L_Right     5 * SCREEN_WIDTH
#define kMG_T           35 * SCREEN_HEIGHT
#define kW              355 / 3 *SCREEN_WIDTH
#define kH              75 *  SCREEN_HEIGHT


#define kMG_L_Center   kMG_L_Right  +  kW + 5*SCREEN_WIDTH

#define kMG_L_Left      kMG_L_Center + kW + 5*SCREEN_WIDTH


#import "ThreeImageCell.h"
@interface ThreeImageCell ()

@property (nonatomic, retain) titleLabel *title;
@property (nonatomic, retain) WordTite *readCount;
@property (nonatomic, retain) BaseImageView *imageLeft;
@property (nonatomic, retain) BaseImageView *imageCenter;
@property (nonatomic, retain) BaseImageView *imageRight;
@property (nonatomic, retain) BaseImageView *footImageView;
@end

@implementation ThreeImageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    
    if (self) {
        [self createSubview];
          

    }
    
    return self;
}


-(void)createSubview
{

    
    
    self.title = [[titleLabel alloc] initWithFrame:CGRectMake(5 * SCREEN_WIDTH, 0, 260* SCREEN_WIDTH, 30 * SCREEN_HEIGHT)];
    self.title.font = [UIFont systemFontOfSize:16 * SCREEN_WIDTH];
    self.title.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
    self.title.textColor = [NightModeHandle shareNightModeHandle].titleColor;
    [self.contentView addSubview:self.title];
    [_title release];
    
    self.readCount = [[WordTite alloc] initWithFrame:CGRectMake((375 - 80) * SCREEN_WIDTH, 5 *SCREEN_HEIGHT, 75 * SCREEN_WIDTH, 30 * SCREEN_HEIGHT)];
    self.readCount.font = [UIFont systemFontOfSize:14 * SCREEN_WIDTH];
    self.readCount.textAlignment = NSTextAlignmentRight;
    self.readCount.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
    self.readCount.textColor = [NightModeHandle shareNightModeHandle].wordColor;
    [self.contentView addSubview:self.readCount];
    self.imageCenter = [[BaseImageView alloc] initWithFrame:CGRectMake(kMG_L_Center, kMG_T, kW, kH)] ;
    self.imageCenter.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
    [self.contentView addSubview:self.imageCenter];
    [_imageCenter release];
    self.imageLeft = [[BaseImageView alloc] initWithFrame:CGRectMake(kMG_L_Left, kMG_T, 355 / 3 * SCREEN_WIDTH, 75 * SCREEN_HEIGHT)];
     self.imageLeft.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
                       [self.contentView addSubview:self.imageLeft];
    [_imageLeft release];
    self.imageRight = [[BaseImageView alloc] initWithFrame:CGRectMake(5 * SCREEN_WIDTH, kMG_T, kW, kH)];
    [self.contentView addSubview:self.imageRight];
     self.imageRight.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
    [_imageRight release];
    
}









- (UIImageView *)footImageView {
    if (!_footImageView) {
        self.footImageView = [[[BaseImageView alloc] initWithFrame:CGRectMake(0, 120 * SCREEN_HEIGHT, 375 * SCREEN_WIDTH, 2 * SCREEN_HEIGHT)] autorelease];
        self.footImageView.image = [UIImage imageNamed:@"mashup_shadow_bottom@2x.png"];
    }
    return [[_footImageView retain] autorelease];
}

-(void)setListModel:(NewsListModel *)listModel{

    if (_listModel != listModel) {
        [_listModel release];
        _listModel = [listModel retain];
        
        self.title.text = listModel.title;

        self.readCount.text =   [self exchangeReply:listModel.replyCount];
        
  [self.imageLeft sd_setImageWithURL:[NSURL URLWithString:listModel.imgsrc] placeholderImage:[UIImage imageNamed:@"background"]];
        
        [self.imageCenter sd_setImageWithURL:[NSURL URLWithString:listModel.imgextra[0][@"imgsrc"]] placeholderImage:[UIImage imageNamed:@"background"]];
        
        [self.imageRight sd_setImageWithURL:[NSURL URLWithString:listModel.imgextra[1][@"imgsrc"]] placeholderImage:[UIImage imageNamed:@"background"]];
        
    }
}


@end
